# Makefile for cda(compression de-compression algorithm).
# Harry Wei <harryxiyou@gmail.com>.
# 2011, @ linux lab in xiyou.

CC		= gcc
CFLAGS		= -g -pipe -O2 -Wall -o 
OBJ		= -c
SOURCES		= main.c			\
		  src/cal_chars.c		\
		  src/huff.c			\
		  src/huffcode.c		\
		  src/compress.c		\
		  src/decompress.c
OBJECTS		= main.o cal_chars.o huff.o huffcode.o compress.o decompress.o
TARGET		= cda
DEL_FILE	= rm -f

all: Makefile $(TARGET)
$(TARGET):$(OBJECTS)
	$(CC) $^ $(CFLAGS) $@
$(OBJECTS):$(SOURCES)
	$(CC) $(OBJ) $^

install:
	cp cda /sbin/
	cp cda /bin/
	cp cda /usr/sbin/
	cp cda /usr/bin/

uninstall:
	rm -rf /sbin/cda
	rm -rf /bin/cda
	rm -rf /usr/sbin/cda
	rm -rf /usr/bin/cda

clean:
	$(DEL_FILE) $(OBJECTS) $(TARGET)
